<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "link".
 *
 * @property string $id ID
 * @property string $title 标题
 * @property string $url 路径
 * @property int $created_at 创建时间
 */
class Link extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'link';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['created_at'], 'integer'],
            [['title', 'url'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'title' => '标题',
            'url' => '路径',
            'created_at' => '创建时间',
        ];
    }

    public function beforeSave($insert)
    {
        $this->created_at=time();
        return parent::beforeSave($insert); // TODO: Change the autogenerated stub
    }
}
